package com.punai.customer.mapper;

import com.punai.common.core.mapper.CommonMapper;
import com.punai.customer.domain.CusFbFee;
import com.punai.customer.domain.vo.CusAllVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 分包费用项Mapper接口
 *
 * @author zxw
 * @date 2022-12-09
 */
public interface CusFbFeeMapper extends CommonMapper<CusFbFee>
{
    /**
     * 查询分包费用项
     *
     * @param id 分包费用项主键
     * @return 分包费用项
     */
    public CusFbFee selectDmcFbFeeById(String id);

    /**
     * 查询分包费用项列表
     *
     * @param dmcFbFee 分包费用项
     * @return 分包费用项集合
     */
    public List<CusFbFee> selectDmcFbFeeList(CusFbFee dmcFbFee);


    /**
     * 删除分包费用项
     *
     * @param id 分包费用项主键
     * @return 结果
     */
    public int deleteDmcFbFeeById(String id);

    /**
     * 批量删除分包费用项
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteDmcFbFeeByIds(String[] ids);

    List<String> selectIdsByChapterIds(@Param("companyId")Long companyId,@Param("chapterIds") List<String> chapterIds);

    List<CusFbFee> selectCusFbFeeList(@Param("entity") CusFbFee fbFee, @Param("chapterIds") List<String> chapterIds,@Param("companyId") Long companyId);

    Integer getMaxOrderNun(@Param("chapterId") String chapterId,@Param("companyId")  Long companyId);

    void moveFeeToNewChapter(@Param("chapterId")String chapterId, @Param("ids") String[] ids, @Param("companyId")Long companyId);

    Integer countByChapterId(@Param("companyId") Long companyId,@Param("specId") String specId);

    /**
     * 成本费用项重新编码
     * @param companyId
     */
    void recodeFb(@Param("companyId") Long companyId,@Param("specId") String specId,@Param("prefix") String prefix,@Param("suffixLen") Integer suffixLen);

    public List<CusFbFee> queryContrast(@Param("companyId")Long companyId, @Param("ids") String[] ids);

    public List<CusAllVo> countFee(@Param("companyId")Long companyId);

    int updateChapterIdIsZero(@Param("chapterIds") List<String> chapterIds,@Param("companyId") Long companyId,@Param("chapterId") String chapterId);

    int countNotAllot(@Param("companyId") Long companyId,@Param("specId") String specId,@Param("notClassifiedId") String notClassifiedId);
}
